<template>
  <div>
    <el-form inline>
      <!-- <el-form-item :label="$t('device.AirCondition')"></el-form-item> -->
      <el-form-item v-if="voltage">
        {{$t('device.Voltage')}}:{{voltage}}
      </el-form-item>
      <el-form-item v-if="current">
        {{$t('device.Current')}}:{{current}}
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
  import BaseController from './BaseController'

  export default {
    name: 'PowerController',
    mixins: [BaseController],
    data() {
      return {
        current: null,
        voltage: null,
      }
    },
    methods: {
      setItemDevice(device) {
        const json = device.map
        if (!json) {
          return
        }
        if (device.code.includes("ROW_RELAY")) {
          if (json.ENERGY) {
            const data = json.ENERGY
            this.voltage = data.Voltage + "V"
            this.current = data.Current + "A"
          }
          return
        }
      }
    }
  }

</script>
